<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Paket_promosi_model extends CI_Model{
	
	function __construct(){
		parent::__construct();
		$this->load->database();
		}
		
	function add($paket_promosi){
		$this->db->insert('paket_promosi', $paket_promosi);
		}
			
	function update($id_paket_promosi, $paket_promosi){
		$this->db->where('paket_promosi.id_paket_promosi', $id_paket_promosi);
		$this->db->update('paket_promosi', $paket_promosi);
		}
		
	function delete($id_kategori_proyek){
		$this->db->where('paket_promosi.id_paket_promosi', $id_paket_promosi);
		$this->db->delete('paket_promosi');
		}
		
	function get_all(){
		$this->db->select('*');
		$this->db->from('paket_promosi');
		$result = $this->db->get();
		return $result;
		}
		
	function get_kategori_proyek($id_paket_promosi){
		$this->db->select('*');
		$this->db->from('paket_promosi');
		$this->db->where('paket_promosi.id_paket_promosi', $id_paket_promosi);
		$result = $this->db->get();
		return $result;
		}
	
	function get_promosi_by_project($id_proyek){
		$this->db->select('*');
		$this->db->from('pilihan_paket_promosi');
		$this->db->join('paket_promosi', 'paket_promosi.id_paket_promosi = pilihan_paket_promosi.id_paket_promosi');
		$this->db->where('id_proyek', $id_proyek);
		$result = $this->db->get();
		return $result;		
	}
}
